package forms
import (
	//m"LiquidMeasurement/models"

"LiquidMeasurement/lib"
	"LiquidMeasurement/models"
)



type AdminCommonForms struct  {
	UserID     int64
	Optype		uint8

}


type ResponeAdminModel struct {
	Tel				string		`valid:"Mobile"`
	UserID          int64
	JobID			string
	UserName    	string
	Passwd			string
	Permission    	int8        //权限位，0x01&Permission == 1,代表管理员权限	//Group     		*Group   `orm:"rel(one)"` // OneToOne relation

	IdentifyCard        string
	Department			uint64
}






type UpdateAdminModel struct {
	Tel				string		`valid:"Mobile"`
	UserID          int64
	JobID			string
	UserName    	string
	Passwd			string
	RePasswd			string

	Permission    	int8        //权限位，0x01&Permission == 1,代表管理员权限	//Group     		*Group   `orm:"rel(one)"` // OneToOne relation

	IdentifyCard        string
	Department			uint64
}

type ChangeFilterForm struct {
	FilterDepartmentID	uint64
	FilterFloor			uint64
}

type MonitorType struct {
	Department models.Department
	DepartmentName	string
	Floor	string
}
//管理员注册json格式
type RegisterType struct {
	UserID              int64
	JobID               string	   `valid:"Required;Msg(用户工号不能为空)"`
	Tel					string	   `valid:"Required;Mobile;Msg(用户电话不能为空)"`
	Passwd				string		`valid:"Required;AlphaNumeric;Msg(用户密码不能为空)"`
	RePasswd				string		`valid:"Required;AlphaNumeric;Msg(用户密码不能为空)"`

	UserName			string		`valid:"Required;AlphaNumeric;Msg(用户名字不能为空)"`
	IdentifyCard        string
	Permission          int8		`valid:"Required;Msg(权限不能为空)"`
	Department			uint64		`valid:"Required;Msg(部门不能为空)"`
}

//func (form *DepartmentManageForm) Valid(v *validation.Validation) {
//
//}

func (form *RegisterType)CheckValid()(b bool,Errors []lib.ERROR)  {
	valid := lib.Validation{}
	b, err_msg := valid.Valid(form)
	return b,err_msg
}


